<template>
  <div>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="id" label="编号" width="180"> </el-table-column>
      <el-table-column prop="name" label="名称" width="180"> </el-table-column>
      <el-table-column prop="expires" label="描述"> </el-table-column>
      <el-table-column prop="origin_price" label="原价"> </el-table-column>
      <el-table-column prop="price" label="单价"> </el-table-column>
      <el-table-column prop="description" label="期限"> </el-table-column>
      <el-table-column prop="" label="创建时间" v-slot:default={row}>
		{{ new Date(row.creat_time).toLocaleString() }}
		<!-- {{row}} -->
	  </el-table-column>
      <el-table-column label="更新日期"  v-slot:default={row}>
		{{ new Date(row.update_time).toLocaleString() }}
	  </el-table-column>
    </el-table>
  </div>
</template>

<script>
import getMember from '@/api/getMember'

export default {
  name: 'Member',
  data() {
    return {
      tableData: []
    }
  },
  methods: {
    // 获取会员接口
    getCen() {
      getMember.getCenter(this.$store.state.token).then((res) => {
        if (res.data.status == 'success') {
          const arr = []
          res.data.data.forEach((item) => {
            const obj = {
              id:item.id,
              expires:item.expires,
              name: item.name,
			  origin_price:item.origin_price,
			  price:item.price,
			  description:item.description,
            }
			arr.push(obj)
          })
		  this.tableData = arr
        }
      })
    }
  },
  // 首次渲染
  mounted() {
    this.getCen()
  }
}
</script>

<style>
</style>